package net.xilou.weibo;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * Created by yong on 2016/3/21.
 */
public class ConfigerHelper {
    protected static Properties props = null;
    static {
        props = new Properties();
        try {
            InputStream in = ConfigerHelper.class.getClassLoader().getResourceAsStream("config.properties");
            props.load(in);
        } catch (IOException e) {
            System.out.println("excpetion : " + e.getMessage());
        }
    }

    public static String get(String key) throws Exception {
        return props.getProperty(key);
    }

    public static String get(String key, String defaultValue) throws Exception {
        String value = get(key);
        return value != null ? value : defaultValue;
    }
}
